package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.HospitalSubscribeMedicalExamTypeMapper;
import com.ruoyi.system.domain.HospitalSubscribeMedicalExamType;
import com.ruoyi.system.service.IHospitalSubscribeMedicalExamTypeService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 体检项目类型Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-26
 */
@Service
public class HospitalSubscribeMedicalExamTypeServiceImpl implements IHospitalSubscribeMedicalExamTypeService 
{
    @Autowired
    private HospitalSubscribeMedicalExamTypeMapper hospitalSubscribeMedicalExamTypeMapper;

    /**
     * 查询体检项目类型
     * 
     * @param id 体检项目类型主键
     * @return 体检项目类型
     */
    @Override
    public HospitalSubscribeMedicalExamType selectHospitalSubscribeMedicalExamTypeById(Long id)
    {
        return hospitalSubscribeMedicalExamTypeMapper.selectHospitalSubscribeMedicalExamTypeById(id);
    }

    /**
     * 查询体检项目类型列表
     * 
     * @param hospitalSubscribeMedicalExamType 体检项目类型
     * @return 体检项目类型
     */
    @Override
    public List<HospitalSubscribeMedicalExamType> selectHospitalSubscribeMedicalExamTypeList(HospitalSubscribeMedicalExamType hospitalSubscribeMedicalExamType)
    {
        return hospitalSubscribeMedicalExamTypeMapper.selectHospitalSubscribeMedicalExamTypeList(hospitalSubscribeMedicalExamType);
    }

    /**
     * 新增体检项目类型
     * 
     * @param hospitalSubscribeMedicalExamType 体检项目类型
     * @return 结果
     */
    @Override
    public int insertHospitalSubscribeMedicalExamType(HospitalSubscribeMedicalExamType hospitalSubscribeMedicalExamType)
    {
        hospitalSubscribeMedicalExamType.setCreateTime(DateUtils.getNowDate());
        return hospitalSubscribeMedicalExamTypeMapper.insertHospitalSubscribeMedicalExamType(hospitalSubscribeMedicalExamType);
    }

    /**
     * 修改体检项目类型
     * 
     * @param hospitalSubscribeMedicalExamType 体检项目类型
     * @return 结果
     */
    @Override
    public int updateHospitalSubscribeMedicalExamType(HospitalSubscribeMedicalExamType hospitalSubscribeMedicalExamType)
    {
        hospitalSubscribeMedicalExamType.setUpdateTime(DateUtils.getNowDate());
        return hospitalSubscribeMedicalExamTypeMapper.updateHospitalSubscribeMedicalExamType(hospitalSubscribeMedicalExamType);
    }

    /**
     * 批量删除体检项目类型
     * 
     * @param ids 需要删除的体检项目类型主键
     * @return 结果
     */
    @Override
    public int deleteHospitalSubscribeMedicalExamTypeByIds(Long[] ids)
    {
        return hospitalSubscribeMedicalExamTypeMapper.deleteHospitalSubscribeMedicalExamTypeByIds(ids);
    }

    /**
     * 删除体检项目类型信息
     * 
     * @param id 体检项目类型主键
     * @return 结果
     */
    @Override
    public int deleteHospitalSubscribeMedicalExamTypeById(Long id)
    {
        return hospitalSubscribeMedicalExamTypeMapper.deleteHospitalSubscribeMedicalExamTypeById(id);
    }

    /**
     * 查询体检项目类型包含套餐内容及套餐内的项目
     * @param hospitalSubscribeMedicalExamType
     * @return
     */
    @Override
    public List<HospitalSubscribeMedicalExamType> getMedicalExamTypeAll(HospitalSubscribeMedicalExamType hospitalSubscribeMedicalExamType) {
        return hospitalSubscribeMedicalExamTypeMapper.getMedicalExamTypeAll(hospitalSubscribeMedicalExamType);
    }

    /**
     * 启用或禁用
     * @param id
     * @return
     */
    @Transactional(rollbackFor = RuntimeException.class)
    @Override
    public int starOrStopById(Long id,int type) {
        return hospitalSubscribeMedicalExamTypeMapper.starOrStopById(id,type);
    }
}
